class Solution {
public:
    vector<int> plusOne(vector<int>& digits) {
        int sz = digits.size();
        for (int i = sz - 1; i >= 0; i--)
        {
            digits[i] = (digits[i] + 1) % 10;
            if (digits[i] != 0)
            {
                return digits;
            }
        }
        vector<int> ans(sz + 1);
        ans[0] = 1;
        return ans;
    }
};